<?php

namespace App\Common\Mapper;

use App\Common\Model\Region;
use Mine\Abstracts\AbstractMapper;

class RegionMapper extends AbstractMapper
{
    public function assignModel()
    {
        $this->model = Region::class;
    }

    /**
     * 获取省名称
     * @param array $ids
     * @return array
     */
    public function getProvinceNameById(array $ids): array
    {
        return $this->model::whereIn('id',$ids)
            ->pluck('name')->toArray();
    }

    public function getProvinceListById(array $ids): array
    {
        $list = $this->model::whereIn('id',$ids)
            ->select(['id','name'])
            ->get()->toArray();
        return $list;
    }

}